﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static S.EliminationOrDath.Read.API.Application.Command.ProductionStatisticsCommand.SheepProductionStatisticsCommand;

namespace S.EliminationOrDath.Read.API.Controllers
{
    /// <summary>
    /// 控制器—种母生产统计
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepProductionStatisticsController : ControllerBase
    {
        private readonly IMediator mediator;

        public SheepProductionStatisticsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 配种统计
        /// </summary>
        /// <param name="date"></param>
        /// <param name="kdate"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetBreedingstatistics(string? date, string? kdate)
        {
            return Ok(await mediator.Send(new GetBreedingstatisticsCommand() { date = date,kdate = kdate}));
        }
        /// <summary>
        /// 显示种母分娩
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetFertilityDataStatistics(string? date,string? kdate)
        {
            return Ok(await mediator.Send(new GetFertilityDataStatisticsCommand() { date = date,kdate = kdate}));
        }
    }
}
